package rule

import (
	"barge/pkg/manager"
	"fmt"
	"github.com/spf13/cobra"
	"strings"
)

var RootCmd = ruleCmd

// ruleCmd represents the base command when called without any subcommands
var ruleCmd = &cobra.Command{
	Use: "rule",
	Aliases: []string{
		"",
	},
	Short: "规则配置",
	Long:  fmt.Sprintf("支持配置以下规则: \n\t%v", strings.Join(manager.ActionInfoManager.ActionBriefs(), "\n\t")),
	// Uncomment the following line if your bare application
	// has an action associated with it:
	// Run: func(cmd *cobra.Command, args []string) { },
	Run: func(cmd *cobra.Command, args []string) {
		_ = cmd.Help()
	},
}

func init() {
	// Here you will define your flags and configuration settings.
	// Cobra supports persistent flags, which, if defined here,
	// will be global for your application.

	// registryCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.image-pusher.yaml)")

	// Cobra also supports local flags, which will only run
	// when this action is called directly.
	ruleCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
